import { _decorator, Button, Component, director, instantiate, Label, Node, Prefab, Sprite, SpriteFrame } from 'cc';
import { RendorManager } from '../Base/RendorManager';
import { ItemStatusEnum, ItemTypeEnum, SceneEnum, TriggerStatusEnum, TriggerTypeEnum } from '../Enum';
import { TriggerManager } from './TriggerManager';
import DataManger from '../RunTime/DataManager';

const { ccclass, property } = _decorator;

@ccclass('DoorTriggerManager')
export class DoorTriggerManager extends TriggerManager{
    type: TriggerTypeEnum = TriggerTypeEnum.Door
    
    rendor(): void {
        super.rendor()
        this.getComponent(Sprite).enabled = DataManger.Instance.DoorStatus === TriggerStatusEnum.Pending
    }

    handleTrigger() {
        if (DataManger.Instance.DoorStatus === TriggerStatusEnum.Pending) {
            DataManger.Instance.curScene=SceneEnum.H2A
        } else {
            DataManger.Instance.curScene=SceneEnum.H3
        }
    }

}